﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace Sasc.PV.Web
{
    public enum DateTimePickerMode
    { 
        DateTime,
        Date,
        Time
    }

    public class DateTimePickerTextBox : TextBox
    {
        #region Ctor
        public DateTimePickerTextBox()
        {
            Mode = DateTimePickerMode.DateTime;
        }
        #endregion

        #region Properties
        public DateTimePickerMode Mode { get; set; }
        #endregion

        #region Override
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            CssClass = string.Format("{0} {1}", CssClass, GetCssClassByMode());
        }
        #endregion

        #region GetCssClassByMode
        protected string GetCssClassByMode()
        {
            switch (Mode)
            {
                case DateTimePickerMode.Date:
                    return "datepicker";
                case DateTimePickerMode.Time:
                    return "timepicker";
                default:
                case DateTimePickerMode.DateTime:
                    return "datetimepicker";
            }
        }
        #endregion
    }
}